home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / ctlib100.zip / INSTALL.LZH / CTLISTBX.INT < prev    next >
Text File  |  1996-10-12  |  6KB  |  159 lines

  1. {**************************************************************************}
  2. {*  BitSoft Development, L.L.C.                                           *}
  3. {*  Copyright (C) 1992 Borland International, Inc.  All rights reserved.  *}
  4. {*  Portions Copyright (C) 1995, 1996 BitSoft Development, L.L.C.         *}
  5. {*  All rights reserved.                                                  *}
  6. {*  Distributed with permission from Borland International, Inc.          *}
  7. {*  Turbo Vision Containers ListBox Unit                                  *}
  8. {*  Version 2.2.3                                                         *}
  9. {**************************************************************************}
  10.  
  11. unit ctListBx;
  12.  
  13. {$X+}
  14.  
  15. interface
  16.  
  17. uses Objects, Drivers, Views,
  18.      Containr, ctTypes;
  19.  
  20. const
  21.   VChars : TScrollChars = (#30, #31, #177, #254, #178);
  22.  
  23.   HChars : TScrollChars = (#17, #16, #177, #254, #178);
  24.  
  25. type
  26.   PImsScrollBar = ^TImsScrollBar;
  27.   TImsScrollBar = object(TView)
  28.       Value : LongInt;
  29.       Min : LongInt;
  30.       Max : LongInt;
  31.       PgStep : LongInt;
  32.       ArStep : LongInt;
  33.     constructor Init (var Bounds : TRect);
  34.     constructor Load (var S : TStream);
  35.     procedure Clicked; virtual;
  36.     procedure Draw; virtual;
  37.     procedure DrawPos (Pos : LongInt); virtual;
  38.     function  GetPalette : PPalette; virtual;
  39.     function  GetPos : LongInt; virtual;
  40.     function  GetSize : LongInt; virtual;
  41.     procedure HandleEvent (var Event : TEvent); virtual;
  42.     procedure ScrollDraw; virtual;
  43.     function  ScrollStep (Part : LongInt) : LongInt; virtual;
  44.     procedure SetChars (AChars : TScrollChars); virtual;
  45.     procedure SetParams (AValue, AMin, AMax, APgStep, AArStep : LongInt);
  46.                          virtual;
  47.     procedure SetRange (AMin, AMax : LongInt); virtual;
  48.     procedure SetStep (APgStep, AArStep : LongInt); virtual;
  49.     procedure SetValue (AValue : LongInt); virtual;
  50.     procedure Store (var S : TStream); virtual;
  51.   private
  52.     Chars : TScrollChars;
  53.   end;  { TImsScrollBar }
  54.  
  55. type
  56.   PImsListViewer = ^TImsListViewer;
  57.   TImsListViewer = object(TView)
  58.       HScrollBar : PImsScrollBar;
  59.       VScrollBar : PImsScrollBar;
  60.       NumCols : LongInt;
  61.       TopItem : LongInt;
  62.       Focused : LongInt;
  63.       Range : LongInt;
  64.       Min : LongInt;
  65.     constructor Init (var Bounds : TRect; ANumCols : Word; AHScrollBar,
  66.       AVScrollBar : PImsScrollBar);
  67.     constructor Load (var S : TStream);
  68.     procedure ChangeBounds (var Bounds : TRect); virtual;
  69.     procedure Draw; virtual;
  70.     procedure FocusItem (Item : LongInt); virtual;
  71.     procedure FocusItemNum (Item : LongInt); virtual;
  72.     function GetPalette : PPalette; virtual;
  73.     function GetText (Item : LongInt; MaxLen : Word) : String; virtual;
  74.     function IsSelected (Item : LongInt) : Boolean; virtual;
  75.     procedure HandleEvent (var Event : TEvent); virtual;
  76.     procedure NewHScrollBar (AHScrollBar : PImsScrollBar); virtual;
  77.     procedure NewVScrollBar (AVScrollBar : PImsScrollBar); virtual;
  78.     procedure SelectItem (Item : LongInt); virtual;
  79.     procedure SetMin (AMin : LongInt); virtual;
  80.     procedure SetRange (ARange : LongInt); virtual;
  81.     procedure SetState (AState : Word; Enable : Boolean); virtual;
  82.     procedure Store (var S : TStream);
  83.   private
  84.     Start : LongInt;
  85.   end;  { TImsListViewer }
  86.  
  87. type
  88.   PSequenceListBox = ^TSequenceListBox;
  89.   TSequenceListBox = object(TImsListViewer)
  90.       List : PSequence;
  91.     constructor Init (var Bounds : TRect; ANumCols : Word; AVScrollBar :
  92.       PImsScrollBar);
  93.     constructor Load(var S: TStream);
  94.     function DataSize : Word; virtual;
  95.     procedure DeleteFocusedItem; virtual;
  96.     procedure DeleteItem (Item : Integer); virtual;
  97.     procedure FreeAll; virtual;
  98.     procedure FreeFocusedItem; virtual;
  99.     procedure FreeItem (Item : Integer); virtual;
  100.     procedure GetData (var Rec); virtual;
  101.     function  GetFocusedItem : Pointer; virtual;
  102.     function GetText (Item : LongInt; MaxLen : Word) : String; virtual;
  103.     procedure HandleEvent (var Event : TEvent); virtual;
  104.     procedure Insert (Item : Pointer); virtual;
  105.     procedure NewList (AList : PSequence); virtual;
  106.     procedure SetData (var Rec); virtual;
  107.     procedure SetFocusedItem (Item : Pointer); virtual;
  108.     procedure SetRange (ARange : LongInt); virtual;
  109.     procedure Store (var S : TStream);
  110.   end;  { TSequenceListBox }
  111.  
  112. type
  113.   PSequenceListBoxRec = ^TSequenceListBoxRec;
  114.   TSequenceListBoxRec = record
  115.     List : PSequence;
  116.     Selection : LongInt;
  117.   end;  { TSequenceListBoxRec }
  118.  
  119. type
  120.   PSortedSequenceListBox = ^TSortedSequenceListBox;
  121.   TSortedSequenceListBox = object(TSequenceListBox)
  122.       SearchPos : LongInt;
  123.     constructor Init (Bounds : TRect; ANumCols : Word; AVScrollBar :
  124.       PImsScrollBar);
  125.     constructor Load (var S : TStream);
  126.     function GetKey (var S : String) : Pointer; virtual;
  127.     procedure HandleEvent (var Event : TEvent); virtual;
  128.   end;  { TSortedSequenceListBox }
  129.  
  130. const
  131.   RImsScrollBar: TStreamRec = (
  132.      ObjType : idImsScrollBar;
  133.      VmtLink : Ofs(TypeOf(TImsScrollBar)^);
  134.      Load    : @TImsScrollBar.Load;
  135.      Store   : @TImsScrollBar.Store);
  136.  
  137.   RImsListViewer: TStreamRec = (
  138.      ObjType : idImsListViewer;
  139.      VmtLink : Ofs(TypeOf(TImsListViewer)^);
  140.      Load    : @TImsListViewer.Load;
  141.      Store   : @TImsListViewer.Store);
  142.  
  143.   RSequenceListBox : TStreamRec = (
  144.     ObjType : idSequenceListBox;
  145.     VmtLink : Ofs(TypeOf(TSequenceListBox)^);
  146.     Load    : @TSequenceListBox.Load;
  147.     Store   : @TSequenceListBox.Store);
  148.  
  149.   RSortedSequenceListBox : TStreamRec = (
  150.     ObjType : idSortedSequenceListBox;
  151.     VmtLink : Ofs(TypeOf(TSortedSequenceListBox)^);
  152.     Load    : @TSortedSequenceListBox.Load;
  153.     Store   : @TSortedSequenceListBox.Store);
  154.  
  155. procedure RegisterListBoxes;
  156.  
  157. implementation
  158. end.
  159.